import { router, Slot, Stack } from "expo-router";
import { StatusBar } from "expo-status-bar";
import { useEffect } from "react";
import AsyncStorage from "@react-native-async-storage/async-storage";

export const unstable_settings = {
  initialRouteName: "setting",
};
export default function RootLayout() {
  useEffect(() => {
    (async () => {
      const data = await AsyncStorage.getItem("userInfo");
      if (data) return;
      router.push("/login");
    })();
  }, []);
  return (
    <>
      <Stack>
        <Stack.Screen name="(tabs)" options={{ headerShown: false }} />
        <Stack.Screen name="login" options={{ headerShown: false }} />
        {/* <Stack.Screen name="info" /> */}
        <Stack.Screen name="+not-found" />
        <Stack.Screen
          name="modal"
          options={{ presentation: "transparentModal", animation: "fade" }}
        />
      </Stack>
      <StatusBar style="light" />
    </>
  );
}
